<template>
    <div  class='printSet'>
        <h2>默认打印机设置</h2>
        <table style='border:1px solid #000;margin-left:auto;margin-right:auto'>
            <colgroup>
                <col style='width:120px'/>
                <col style='width:300px'/>
            </colgroup>
            <tr>
                <td>普通打印机</td>
                <td><select id="print_select" v-model="print1"></select></td>
            </tr>
            <tr>
                <td>二维码打印机</td>
                <td><select id="print_select2" v-model="print2"></select></td>
            </tr>
            <tr>
                <td>针式打印机</td>
                <td><select id="print_select3" v-model="print3"></select></td>
            </tr>
        </table>
        <el-button type="primary" style='margin-top:15px' @click="save">保存</el-button>
    </div>
    
    
</template>
<script>

import { getLodop } from '../../../utils/LodopFuncs'
export default {
    data(){
        return{
            LODOP:null,
            print1:"",
            pritn2:"",
            print3:""
        }
    },
    created(){
        let sef=this;
        window.setTimeout(function(){
            sef.LODOP = getLodop();
            sef.LODOP.Create_Printer_List(document.getElementById("print_select"));
            sef.LODOP.Create_Printer_List(document.getElementById("print_select2"));
            sef.LODOP.Create_Printer_List(document.getElementById("print_select3"));
            sef.readData();
        },1500)
        
    },
    methods:{
        save(){
            this.$post("business","api/print/printSet",{
                print1:this.print1,
                print2:this.print2,
                print3:this.print3,
                osmsg:localStorage.getItem("osmsg")
            }).then(data=>{
                 this.$message({
                    message: '保存成功',
                    type: 'success'
                });
            })
        },
        readData(){
             this.$post("business","api/print/getPrintSet",{
                osmsg:localStorage.getItem("osmsg")
            }).then(data=>{
                 this.print1=data.print1;
                 this.print2=data.print2;
                 this.print3=data.print3;
            })
        },
        getSystemInfo(strINFOType,oResultOB){
           
            if (this.LODOP.CVERSION) CLODOP.On_Return=function(TaskID,Value){
               // alert(value)
            }; 
            var strResult=LODOP.GET_SYSTEM_INFO(strINFOType);
            if (!this.LODOP.CVERSION) return strResult; else return "";
        }
    }
}
</script>
<style scoped>
    .printSet{
        padding:50px;
        text-align:center;
    }
    td{
        height:40px;
    }
</style>